Conditional return type for SQLite3Result::fetchArray()#3080
Conditional return type for SQLite3Result::fetchArray()#3080staabm merged 1 commit intophpstan:2.1.xfrom
SQLite3Result::fetchArray()#3080Conversation
|
You mean tests for types? Sure: https://phpstan.org/developing-extensions/testing#type-inference Here most of them are in NodeScopeResolverTest. |
|
Hi @devnix, are you still interested by this PR ? If so, please now target 2.1.x instead. Thanks |
106d4b6 to
ee87b7e
Compare
VincentLanglet
left a comment
There was a problem hiding this comment.
Is a similar return type possible for fetchAll ?
https://github.com/JetBrains/phpstorm-stubs/blob/34a487bd374e42f4ce58606473d1b6882bfec2b7/sqlite3/sqlite3.php#L642
(will need to be in php85delta since it was introduced in php 8.5).
Also might be worth to add fetchArray has having sideEffect to avoid something like
https://phpstan.org/r/7281fb29-1861-4297-8c50-4a708cbebf1c
ee87b7e to
13e7254
Compare
Great catch @VincentLanglet, done! |
| @@ -0,0 +1,31 @@ | |||
| <?php // php >= 8.5 | |||
There was a problem hiding this comment.
| <?php // php >= 8.5 | |
| <?php // lint >= 8.5 |
…3Result::fetchAll()`
13e7254 to
65f55ab
Compare
|
thank you |
I'm aware that this change can be wrong or incomplete. I was wondering if there is a way in this project to do tests for types, for example https://github.com/azjezz/psl/blob/next/tests/static-analysis